#ifndef IGSLIB_VR_H
#define IGSLIB_VR_H

#include <set>
#include <igslib_ivr.h>

namespace igslib 
{
    class CVR:public IVR
    {
        protected:
            float last_pos;
            float now_pos;
            ISpi* spi;
        public:
            CVR()
            {
                last_pos = 0;
                now_pos = 0;
                spi = nullptr;
            }
            virtual int GetPosition(float* result)
            {
                *result = now_pos;
                return 0;
            }
			virtual int GetOffset(float* result)
            {
                *result = now_pos - last_pos;
                last_pos = now_pos;
                return 0;
            }
            virtual void SetSPI(ISpi* value) { spi = value; }
    };

    class CVRManager:public IVRManager
    {
        static IVRManager* instance;
        public:
            static IVRManager* GetInstance();
            IVR* NewM01VR();
			IVR* New_ProjMCU(const std::string&);
    };
};

#endif
